//
//  UIButton+lvfj.m
//  SaiNiuHui
//
//  Created by 吕飞俊 on 15/9/24.
//  Copyright © 2015年 国都快易科技（深圳）有限公司. All rights reserved.
//

#import "UIButton+lvfjHelper.h"
#import "UIView+lvfjHelper.h"

@implementation UIButton (lvfjHelper)


-(void)titleMinusOne{
    [self titleWithNo:@"-1"];
}

-(void)titleAddOne{
    [self titleWithNo:@"+1"];
}

-(void)titleWithNo:(NSString *)str{
    CGFloat count = [str floatValue];
    CGFloat title = [self.titleLabel.text floatValue];
    [self setTitle:[NSString stringWithFormat:@"%f",[str hasPrefix:@"-"]?title-count: title+count] forState:UIControlStateNormal];
}

-(void)setImgAndTitle:(NSString *)tittle
            forState:(UIControlState)state{
    [self setTitle:[NSString stringWithFormat:@"  %@",tittle] forState:state];
}

@end
